<template>
	<view class="t-login">
		<br><br><br><br>
		<br><br><br><br>
		<form class="cl">
			<view class="t-a">
				<image src="../../static/phone.png"></image>
				<input type="number" name="phone"
				 placeholder="请输入手机号" maxlength="11" v-model="phone"/>
			</view>
			<view class="t-a">
				<image src="../../static/messagecode.jpg"></image>
				<input type="number" name="code" maxlength="6"
				 placeholder="请输入验证码" v-model="yzm"/>
				 <view v-if="showText" class="t-c" @tap="getCode()">发送短信</view>
				 <view v-else class="t-c"
				 style="background-color: #A7A7A7 ;">重新发送({{second}})</view>
			</view>
			<button @tap="login()">登录</button>
		</form>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				showText:true,
				second:0,
				telephone:'',
				validcode:'',
				phone:'',
				yzm:''
			}
		},
		methods: {
			login(){
				try{
					this.telephone=this.phone;
					uni.setStorageSync('phone',this.telephone);
					console.log("success");
				}catch(e){
					
				}
				uni.setStorage({
					key:'yzm',
					data:this.validcode,
					success:function(){
						console.log("success");
					}
				})
				uni.switchTab({
					url:'../index/index'
				})
			},
			getCode(){
				console.log(this.phone)
			}
		}
	}
</script>

<style>
	.t-login{
		width: 600rpx;
		margin: 0 auto;
		font-size: 28rpx;
		color: #000;
	}
	.t-login .t-a{
		position: relative;
	}
	.t-login .t-a image{
		width: 50rpx;
		height: 50rpx;
		position: absolute;
		left: 40rpx;
		top: 28rpx;
		border-right: 2rpx solid #dedede;
		padding-right: 20rpx;
	}
	.t-login .t-c{
		position: absolute;
		right: 22rpx;
		top: 22rpx;
		background: #5677fc;
		color: #FFf;
		font-size: 24rpx;
		border-radius: 50rpx;
		height: 50rpx;
		line-height: 50rpx;
		padding: 0 25rpx;
	}
	.t-login button{
		font-size: 28rpx;
		background: #5677FC;
		color: #FFFFFF;
		height: 90rpx;
		line-height: 90rpx;
		border-radius: 50rpx;
		box-shadow: 0 5px 7px 0 rgba(86,119,252,0.2);
	}
	.t-login input{
		padding: 0 20rpx 0 120rpx;
		height: 90rpx;
		line-height: 90rpx;
		margin-bottom: 50rpx;
		background: #f8f7fc;
		border: 1px solid #e9e9e9;
		font-size: 28rpx;
		border-radius: 50rpx;
	}
	.cl{
		zoom: 1;
	}
</style>
